A shortcut fusion approach to accumulations

نویسندگان

  • Mónica Martínez
  • Alberto Pardo
چکیده

In functional programming it is common to write programs as composition of other simpler functions. This makes it possible to take advantage of the well-known benefits of modular programming. However, in many cases, the resulting programs have efficiency problems caused by the generation of data structures that are solely used for communication between the intervening functions in the compositions. Many of those intermediate structures can be eliminated by an appropriate combination of the codes of the involved functions using a technique called program fusion. In this work, we propose program fusion techniques for accumulations, which are recursive functions that use additional parameters for keeping intermediate results. Accumulations are known to be difficult to be fused because of the presence of the additional parameters and the fact that in many cases results are computed in those parameters. Our analysis is based on a shortcut fusion approach which turns out to be effective in the case of accumulations. We present benchmarks that illustrate the impact of shortcut fusion on accumulations.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Applicative Shortcut Fusion

In functional programming one usually writes programs as the composition of simpler functions. Consequently, the result of a function might be generated only to be consumed immediately by another function. This potential source of inefficiency can often be eliminated using a technique called shortcut fusion, which fuses both functions involved in a composition to yield a monolithic one. In this...

متن کامل

Multiple Intermediate Structure Deforestation by Shortcut Fusion

Shortcut fusion is a well-known optimization technique for functional programs. Its aim is to transform multi-pass algorithms into single pass ones, achieving deforestation of the intermediate structures that multi-pass algorithms need to construct. Shortcut fusion has already been extended in several ways. It can be applied to monadic programs, maintaining the global effects, and also to obtai...

متن کامل

Shortcut Fusion of Monadic Programs

Functional programs often combine separate parts of the program using intermediate data structures for communicating results. Programs so defined are easier to understand and maintain, but suffer from inefficiency problems due to the generation of those data structures. In response to this problematic, some program transformation techniques have been studied with the aim to eliminate the interm...

متن کامل

Semantics and Pragmatics of New Shortcut Fusion Rules

We study various shortcut fusion rules for languages like Haskell. Following a careful semantic account of a recently proposed rule for circular program transformation, we propose a new rule that trades circularity for higher-orderedness, and thus attains better semantic properties. This also leads us to revisit the original foldr/build-rule, as well as its dual, and to develop variants that do...

متن کامل

Stream fusion : practical shortcut fusion for coinductive sequence types

In functional programming it is common practice to build modular programs by composing functions where the intermediate values are data structures such as lists or arrays. A desirable optimisation for programs written in this style is to fuse the composed functions and thereby eliminate the intermediate data structures and their associated runtime costs. Stream fusion is one such fusion optimis...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • Sci. Comput. Program.

دوره 78  شماره 

صفحات  -

تاریخ انتشار 2013